import request from '@/hooks/request'

const Api = {
  getInviteeRecordList: 'platform/user/getInviteeRecordList', // 下级列表
  getPutawayPointProductList: '/platform/pointProduct/getPutawayPointProductList', // 查询积分商品列表
  exchangePointProduct: '/platform/pointProduct/exchangePointProduct', // 兑换
  getExchangePointProductRecordList: '/platform/pointProduct/getExchangePointProductRecordList', // 兑换记录列表
  getPointRecordList: 'platform/user/getPointRecordList', // 积分明细
  getPointCardRecord: 'platform/user/getPointCardRecord', // 旧的下级列表
}

export const getPointCardRecord = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getPointCardRecord,
    data: parameter,
  })
}

export const getInviteeRecordList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getInviteeRecordList,
    data: parameter,
  })
}

export const getPutawayPointProductList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getPutawayPointProductList,
    data: parameter,
  })
}

export const exchangePointProduct = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.exchangePointProduct,
    data: formData,
  })
}

export const getExchangePointProductRecordList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getExchangePointProductRecordList,
    data: parameter,
  })
}

export const getPointRecordList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getPointRecordList,
    data: parameter,
  })
}
